package com.rw.pay.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rw.common.entity.DollarInfo;
import com.rw.common.entity.Receive;
import com.rw.pay.service.DollarInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.bind.DefaultValue;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 优惠券表 前端控制器
 * </p>
 *
 * @author Rabit
 * @since 2021-12-20
 */
@RestController
@RequestMapping("/common/dollarInfo")
public class DollarInfoController {

        @Autowired
        private DollarInfoService dollarInfoService;


        @GetMapping("{id}")
        public DollarInfo getDataById(@PathVariable Integer id){
                DollarInfo info = dollarInfoService.getById(id);
                return info;
        }

        @GetMapping("list")
        public List<DollarInfo> getList(){
                List<DollarInfo> list = dollarInfoService.list();
                return list;
        }

        @GetMapping("page/{num}/{size}")
       public Page<DollarInfo> getPage(@PathVariable("num") Integer num,@PathVariable("size") Integer size){
               Page<DollarInfo> page = new Page(num,size);
               Page<DollarInfo> dollarInfoPage = dollarInfoService.getBaseMapper().selectPage(page, null);
                return dollarInfoPage;
       }


}

